var resourceUploadUrl:String;
var uploadQueue:Array = new Array();

function setResourceServerUrl()
{
	// var conf=mlf.gatekeeper.native.Caller.loadLSO("Configuration");
	var conf=Packages.system.MLF.loadConfiguration();
	var httpUrl="http://"+conf.host+"/"+conf.app;
	resourceUploadUrl=httpUrl+"/upload";
}

function addFileToUploadQueue(file:Object):Boolean {
	for (var i:Number = 0; i<uploadQueue.length; i++) {
		if (uploadQueue[i].item.name == file.item.name) {
			return false;
		}
	}
	for (var i:Number = 0; i<convertQueue.length; i++) {
		if (convertQueue[i].item.name == file.item.name) {
			return false;
		}
	}
	trace("addFileToUploadQueue success");
	uploadQueue.push(file);
	return true;
}

function delFileFromUploadQueue(jobId:Number):Object {
	var file:Object = new Object();
	for (var i:Number = 0; i<uploadQueue.length; i++) {
		file = uploadQueue[i];
		if (uploadQueue[i].jobId == jobId) {
			uploadQueue.splice(i, 1);
			return file;
		}
	}
	return null;
}

function getResourceUploadUrl():String
{
	return resourceUploadUrl;
}